Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LogIndex and TxIndex into logs/event response body #862

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

paologalligit
Copy link
Member

Description

This PR adds logIndex and txIndex fields into logs/event response body.

GH Issue

Type of change

Please delete options that are not relevant.

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

  • Manual test
  • Unit test
  • E2E test

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • New and existing E2E tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have not added any vulnerable dependencies to my code

@paologalligit paologalligit requested a review from a team as a code owner October 11, 2024 08:16
@codecov-commenter
Copy link

codecov-commenter commented Oct 11, 2024

Codecov Report

Attention: Patch coverage is 84.50704% with 11 lines in your changes missing coverage. Please review.

Project coverage is 60.65%. Comparing base (49d9704) to head (f81bc85).

Files with missing lines Patch % Lines
api/events/types.go 61.53% 5 Missing ⚠️
logdb/sequence.go 73.33% 2 Missing and 2 partials ⚠️
logdb/logdb.go 93.75% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #862      +/-   ##
==========================================
+ Coverage   60.62%   60.65%   +0.03%     
==========================================
  Files         215      215              
  Lines       23099    23139      +40     
==========================================
+ Hits        14003    14035      +32     
- Misses       7947     7953       +6     
- Partials     1149     1151       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@paologalligit paologalligit changed the base branch from master to feat/db October 29, 2024 10:37
thor/params.go Outdated Show resolved Hide resolved
api/events/types.go Outdated Show resolved Hide resolved
logdb/logdb.go Outdated Show resolved Hide resolved
nullable: true
example: 1
logIndex:
descrption: The index of the log in the receipt's outputs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to highlight it's an overall index among all clauses.

@@ -504,7 +507,7 @@ func (w *Writer) Write(b *block.Block, receipts tx.Receipts) error {

if err := w.exec(
query,
newSequence(blockNum, eventCount),
newSequence(blockNum, uint32(txIndex), eventCount),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eventCount and transferCount needs to be reset for every receipt/tx.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the logic of insert blockID into ref needs to be updated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eventCount and transferCount needs to be reset for every receipt/tx.

Are we changing the indexes logic? Before the count was not reset to 0 every receipt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think by adding txIndex we are trying to align with ethereum's filter API, so we need to change the concept of logIndex.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blockID insertion logic updated

@darrenvechain
Copy link
Member

darrenvechain commented Nov 6, 2024

@paologalligit possible to trigger CI? You may have to rebase with target branch. I think @libotony had issues on his mainDB branch, not sure how he solved

@libotony
Copy link
Member

libotony commented Nov 7, 2024

@paologalligit possible to trigger CI? You may have to rebase with target branch. I think @libotony had issues on his mainDB branch, not sure how he solved

Here, #868 (comment)

Wired that tests won't run with this PR only, might be caused by the on-pull-request.yaml wasn't updated in the master branch, but after PR #871 was opened, CI was trigger for targeting master then with the same commit hash of this PR, the workflow was also linked here.

@paologalligit paologalligit changed the base branch from feat/db to master November 7, 2024 09:33
@libotony
Copy link
Member

libotony commented Nov 7, 2024

@paologalligit I think the logIndex and txIndex also need to be applied to logs/transfers.

@darrenvechain darrenvechain changed the base branch from master to feat/db November 7, 2024 12:06
@darrenvechain darrenvechain changed the base branch from feat/db to master November 7, 2024 12:07
otherview
otherview previously approved these changes Nov 7, 2024
Copy link
Member

@otherview otherview left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm !

api/events/events.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants